package com.chen.project.white_jotter.config;

import com.chen.project.white_jotter.constants.Constants;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "site")
@Setter
@Getter
public class SiteProps {

    private String rearAddress;
    private String frontAddress;
    private String osType;
    private String filePath;

    // 改变默认的 set 注入
    public void setFilePath(String filePath) {
        if(getOsType().contains("Windows")){
            this.filePath = Constants.WINDOWS_FILE_PATH;
        }else if(getOsType().contains("Linux")){
            this.filePath = Constants.LINUX_FILE_PATH;
        }
    }
}
